package com.doublecheck.project.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.sencha.gxt.widget.core.client.container.CenterLayoutContainer;
import com.sencha.gxt.widget.core.client.container.Viewport;

public class Main implements EntryPoint {
	
	private Viewport viewport;
	
	private BarChart barChart;
	private LineChart lineChart;
	private RadarChart radarChart;
	private GaugeChart gaugeChart;
	private ScatterPlot scatterPlot; 
	private StackedBarChart stackedBarChart;
	
	private BarChart_Dataset dataset  = new BarChart_Dataset();
    private RadarChart_Dataset dataset2 = new RadarChart_Dataset();
    private LineChart_Dataset dataset3  = new LineChart_Dataset();
    private GaugeChart_Dataset dataset1 = new GaugeChart_Dataset();
    private ScatterPlot_Dataset dataset4 = new ScatterPlot_Dataset();
    private StackedBarChart_Dataset dataset5 = new StackedBarChart_Dataset();    
    
	private Sample sample = new Sample();
	@Override
	public void onModuleLoad() {			
		viewport = new Viewport();	 
		
		dataset.addItem(sample.cate0, sample.age0, sample.wet0, sample.hb0);
		dataset.addItem(sample.cate1, sample.age1, sample.wet1, sample.hb1);
		dataset.addItem(sample.cate2, sample.age2, sample.wet2, sample.hb2);
		dataset.addItem(sample.cate3, sample.age3, sample.wet3, sample.hb3);
		dataset.addItem(sample.cate4, sample.age4, sample.wet4, sample.hb4);		
		
		dataset2.addItem(sample.cate0, sample.age0);
		dataset2.addItem(sample.cate1, sample.age1);
		dataset2.addItem(sample.cate2, sample.age2);
		dataset2.addItem(sample.cate3, sample.age3);
		dataset2.addItem(sample.cate4, sample.age4);		
		
		dataset3.addItem(sample.cate0, sample.age0, sample.wet0, sample.hb0);
		dataset3.addItem(sample.cate1, sample.age1, sample.wet1, sample.hb1);
		dataset3.addItem(sample.cate2, sample.age2, sample.wet2, sample.hb2);
		dataset3.addItem(sample.cate3, sample.age3, sample.wet3, sample.hb3);
		dataset3.addItem(sample.cate4, sample.age4, sample.wet4, sample.hb4);		
		
		dataset1.addItem(sample.cate0, sample.age0);
		
		dataset4.addItem(sample.cate0, sample.age0);
		dataset4.addItem(sample.cate1, sample.age1);
		dataset4.addItem(sample.cate2, sample.age2);
		dataset4.addItem(sample.cate3, sample.age3);
		dataset4.addItem(sample.cate4, sample.age4);		
		
		dataset5.addItem(sample.cate0, sample.age0, sample.wet0, sample.hb0);
		dataset5.addItem(sample.cate1, sample.age1, sample.wet1, sample.hb1);
		dataset5.addItem(sample.cate2, sample.age2, sample.wet2, sample.hb2);
		dataset5.addItem(sample.cate3, sample.age3, sample.wet3, sample.hb3);
		dataset5.addItem(sample.cate4, sample.age4, sample.wet4, sample.hb4);		
		
		barChart = new BarChart(3, dataset, "Health Measurements", "Member", AxisType.CategoryAxis, "Measurements", AxisType.NumericAxis);
		lineChart = new LineChart(3, dataset3, "Health Measurements", "Measurements", AxisType.NumericAxis, "Member", AxisType.CategoryAxis);
		radarChart = new RadarChart(dataset2, "Age Distribution of Family Members");
		gaugeChart = new GaugeChart(dataset1, "Age");
		scatterPlot = new ScatterPlot(dataset4, "Age Distribution");
		stackedBarChart = new StackedBarChart(dataset5, "Health Check", "Measurement", AxisType.NumericAxis, "Member", AxisType.CategoryAxis);
		
		HorizontalPanel hp = new HorizontalPanel();
		HorizontalPanel hp1 = new HorizontalPanel();		
		VerticalPanel vp = new VerticalPanel();
		CenterLayoutContainer con = new CenterLayoutContainer();
		
		hp1.add(radarChart.asWidget());
		hp1.add(stackedBarChart.asWidget());
		hp1.add(scatterPlot.asWidget());
		vp.add(hp1.asWidget());
		hp.add(gaugeChart.asWidget());
		hp.add(barChart.asWidget());
		hp.add(lineChart.asWidget());	
		vp.add(hp.asWidget());
		con.add(vp);
		viewport.setWidget(con);
		RootPanel.get().add(viewport);
	}
}
